<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>计时器</title>
	<style type="text/css">
	.time_return{
		width: 200px;
		height: 30px;
		background: red;
		color: #000;
	}
	.box_change{
		width:200px;
		height: 200px;
		background: green;
	}
	</style>

</head>
<body>
<div class="time_return" id='time_return'></div>
<div class="box_change" id='box_change'></div>
	<script type="text/javascript">
	var box=document.getElementById('time_return');
	str="秒后返回百度";
	num=5;
	function aa () {
		box.innerText=num+str;
		if(num==0){
			location.href="http://www.baidu.com";
		}
		num--;
	}
	var time1 = setInterval(aa,1000);	

// --------------------------------------------------------------
	
	var box1=document.getElementById('box_change');
	var width = parseInt(getComputedStyle(box1).width);
	var height = parseInt(getComputedStyle(box1).height);
	var abc=0;
	function run () {

	  if(width<200){
	  	abc=0
	  }
	  if(width>400){
	  	abc=1;
	  }
	  if(abc==0){
	  	width +=5;
	  	height +=5;
	  }else{
	  	width -=5;
	  	height -=5;
	  }
	  		box1.style.width= width+"px";
			box1.style.height= height+"px";
	}

		var time1 = setInterval(run, 10);


		box1.onmouseover = function  (argument) {
			clearInterval(time1);
		}


		box1.onmouseout = function  (argument) {
			time1 = setInterval(run, 10);
		}

	</script>	
</body>
</html>